<template>
    <div>
         <headers></headers>
         <van-row>
             <van-col span="4">
              <left/>
            </van-col>
            <van-col span="20">
               <van-uploader :after-read="upload"/>
            </van-col>
         </van-row>
         <!-- <div style="position: absolute;top: 60px;left: 200px">
            <p>组织名称：<input type="text">
                <van-button>查询</van-button>
                <van-button>重置</van-button>
            </p >
            <p>
                <van-button style="background-color: cornflowerblue">+新增</van-button>
                <van-button>导入</van-button>
                <van-button>导出</van-button>
            </p >
        </div> -->

          <div>

            <el-tree
    :data="data"
    show-checkbox
    node-key="id"
    :default-expanded-keys="[2, 3]"
    :default-checked-keys="[5]"
    :props="defaultProps"
  />

          </div>
         
        
    </div>
</template>

<script>
// import maxios from '../http/axios'
import axios from 'axios'
import headers from '../comm/headers.vue'
import left from '../comm/left.vue'
export default {
     components:{
        'headers':headers,
        'left':left
    },
    data() {
        return {
          data: [],
          defaultProps: {
        children: 'son',
        label: 'label',
      },
  }
    },
    methods: {
        upload(file){
            let formData = new FormData()
            formData.append('file',file.file)
            console.log(formData);
            formData.forEach((value, key) => {
                console.log("key %s: value %s", key, value);
            })
            axios({url:'http://127.0.0.1:5000/upload',method:'post',data:formData}).then(res => {
                console.log(res)
            })
            // maxios('upload','post',formData).then(res => {
            //     console.log(res)
            // })
        },
        handleNodeClick(data) {
      console.log(data)
      },
    },
    created() {

    }
}
</script>

<style scoped>

</style>
